# Contributor: Thomas Harning Jr. <harningt@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=davfs2
pkgver=1.6.0
pkgrel=0
pkgdesc="Linux FUSE (or coda) driver that allows you to mount a WebDAV resource"
url="http://savannah.nongnu.org/projects/davfs2"
options="suid"
pkggroups="davfs2"
arch="all"
license="GPL-3.0-or-later"
makedepends="autoconf automake libtool libxml2-dev linux-headers neon-dev zlib-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-doc"
source="https://download.savannah.gnu.org/releases/davfs2/davfs2-$pkgver.tar.gz
	010-main_code_fix.patch
	100-musl-compat.patch
	"

prepare() {
	default_prepare
	aclocal -I config \
	        && autoheader \
	        && automake --add-missing --force-missing --copy \
	        && autoconf
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		dav_user=nobody \
		--enable-largefile
	make
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
	install -o root -g davfs2 -m 1774 -d "$pkgdir"/var/run/mount.davfs
}

sha512sums="e016eb847152b7d0c20abfdafd36f43fcff29339362be6765202a45692a186c70b1c33d3566ed8ca695c399a7f0ca1aef7b05d378cdda33d892cb684da34de33  davfs2-1.6.0.tar.gz
1d839b1435ae67209aae2501c1188880e991adece7b34b6b91d1fcba7390fd9d72d2aa7e057d03ed9f1519e682d0f0a8472c47ed64f78a25fe0f67c54a847ce3  010-main_code_fix.patch
66dd968d85a18d281d8a41e15b17f0344accfe44951fa17d1d5c9f9bb67442f4d1410adda144562fa45bd561837c486d24f98ac2a0da4800a1e7dd79126caec7  100-musl-compat.patch"
